#include <stdio.h>

int findnum(int num[3][3], int x, int y, int key);

int main() {
	int num[3][3] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
	int x = 3, y = 3;

	int key = 0;
	scanf("%d", &key);

	printf("%d ", findnum(num, x, y, key));

	return 0;
}

int findnum(int num[3][3], int x, int y, int key) {
	int i = 0, j = y;
	while (i < x && j >= 0) {
		if (num[i][j] < key) {
			i++;
		} else if (num[i][j] > key) {
			j--;
		} else {
			return 1;
		}
	}
	return 0;
}